package com.wu.project.admin.api;

import com.wu.project.admin.annotations.Authorization;
import com.wu.project.admin.annotations.Log;
import com.wu.project.admin.component.JsonResult;
import com.wu.project.admin.entity.OrderQueryVO;
import com.wu.project.admin.entity.RefundVO;
import com.wu.project.admin.property.Constants;
import com.wu.project.admin.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xuan
 */
@RequestMapping("/business")
@RestController
public class BusinessApi {

    @Autowired
    BusinessService businessService;

    @Authorization
    @Log(name = "获取订单列表")
    @PostMapping(value = "/order", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult orders(@RequestBody OrderQueryVO orderQueryVO) {
        return businessService.getOrder(orderQueryVO);
    }

    @Authorization
    @Log(name = "获取订单详情")
    @GetMapping(value = "/order/detail", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult orderDetail(String orderId) {
        return businessService.getOrderDetail(orderId);
    }

    @Authorization
    @Log(name = "获取退订列表")
    @PostMapping(value = "/refuse", produces = Constants.APPLICATION_JSON_UTF8)
    public JsonResult returnGoods(@RequestBody RefundVO refundVO){
        return businessService.getRefundList(refundVO);
    }
}
